package org.dftproject.gedcom.core;

import org.dftproject.genesis.data.genealogy.NameConstants;
import org.dftproject.genesis.data.genealogy.impl.NameImpl;
import org.dftproject.genesis.data.genealogy.impl.NamePartImpl;

public class GedcomName extends NameImpl {

	public GedcomName(Line record) {
		for (String part : record.getValue().split("\\s+")) {
			if (part.matches("^/.*/$")) {
				add(new NamePartImpl(part.replaceAll("^/|/$", ""), NameConstants.SURNAME));
			} else {
				add(new NamePartImpl(part));
			}
		}
	}

}
